home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / gfx / edit / AmiCAD_2.07.lha / AmiCAD / ARexx / SelectParts.AmiCAD < prev    next >
Text File  |  2000-11-12  |  4KB  |  102 lines

  1. /* Sélection des composants du type sélectionné ou spécifié
  2.    This script selects all the components with the same name
  3.    © R.Florac, Chez Corbin, 19 mars 1998, v1.00
  4.    Version 1.01, 20 avril 1998 (ajout affichage type d'élément)
  5.    Version 1.02, 27 avril 1998 (ajout rectangles)
  6.    Version 1.03, 1er juin 1998 (signalisation jokers)
  7.    Version 1.04, 14 avril 2000 (adaptation version 2.05)
  8.    Version 1.05, 11 novembre 2000 (localisation anglais/français)
  9.    $VER: SelectParts.AmiCAD 1.05 (© R.Florac, 11 Novembre 2000) */
  10.  
  11. options results     /* indispensable pour récupérer le résultat des macros */
  12.  
  13. signal on error     /* pour l'interception des erreurs */
  14. signal on syntax
  15.  
  16. 'LANGUAGE'
  17. if result="français.language" then fr=1
  18. else fr=0
  19.  
  20. 'FIRSTSEL'; objet = result
  21. if objet = 0 then do
  22.     if fr=1 then 'COMPOSANT=ASKTEXT("Quel est le nom du"+CHR(10)+"composant recherché ?"+CHR(10)+"Vous pouvez utiliser"+CHR(10)+"les jokers pour étendre"+CHR(10)+"la recherche (Ex: Diod#?)","")'
  23.     else 'COMPOSANT=ASKTEXT("What is the name of"+CHR(10)+"the searched component ?"+CHR(10)+"You can use the"+CHR(10)+"jokers to expand"+CHR(10)+"the search (Ex: Diod#?)","")'
  24.     part=result
  25.     if part="" then exit
  26. end
  27. else do
  28.     'COMPOSANT=PARTNAME('objet')'
  29.     part=result
  30.     if part="" then do
  31.     'TYPE('objet')'; type=result
  32.     'SECURITY(OBJECTS+10):FOR(I=1:N=0,I<=OBJECTS,IF(TYPE(I)=='type',MARK(I):N=N+1,0),I=I+1)'
  33.     'N'; n=result
  34.     affichage(n,type)
  35.     exit
  36.     end
  37. end
  38. 'SECURITY(OBJECTS+10):N=0:I=0:WHILE(I=IF(I+1<=OBJECTS,FINDPART(I+1,COMPOSANT),0),MARK(I):N=N+1)'
  39. 'N'; n=result
  40. affichage(n,1)
  41.  
  42. exit
  43.  
  44. affichage: procedure expose part fr
  45.     parse arg nombre, type
  46.     if fr=1 then do
  47.     select
  48.         when type = 1 then element = part
  49.         when type = 2 then element = "fil de liaison"
  50.         when type = 3 then element = "arc de cercle"
  51.         when type = 4 then element = "texte"
  52.         when type = 5 then element = "référence de composant"
  53.         when type = 6 then element = "valeur de composant"
  54.         when type = 7 then element = "connexion"
  55.         when type = 8 then element = "fil en pointillé"
  56.         when type = 9 then element = "bus"
  57.         when type = 10 then element = "ellipse"
  58.         when type = 11 then element = "connecteur d'entrée"
  59.         when type = 12 then element = "connecteur de sortie"
  60.         when type = 15 then element = "trait double"
  61.         when type = 21 then element = "ligne personnalisée"
  62.         when type = 22 then element = "rectangle"
  63.         otherwise element = "élément"
  64.     end
  65.     'MESSAGE("Type d''élément sélectionné:"+CHR(10)+"'element'"+CHR(10)+"Quantité trouvée: 'nombre'")'
  66.     end
  67.     else do
  68.     select
  69.         when type = 1 then element = part
  70.         when type = 2 then element = "wire"
  71.         when type = 3 then element = "arc"
  72.         when type = 4 then element = "text"
  73.         when type = 5 then element = "component reference"
  74.         when type = 6 then element = "component value"
  75.         when type = 7 then element = "junction"
  76.         when type = 8 then element = "dashed line"
  77.         when type = 9 then element = "bus"
  78.         when type = 10 then element = "ellipse"
  79.         when type = 11 then element = "input connector"
  80.         when type = 12 then element = "output connector"
  81.         when type = 15 then element = "double line"
  82.         when type = 21 then element = "special line"
  83.         when type = 22 then element = "box"
  84.         otherwise element = "object"
  85.     end
  86.     'MESSAGE("Selected object:"+CHR(10)+"'element'"+CHR(10)+"Quantity found: 'nombre'")'
  87.     end
  88.     exit
  89. end
  90.  
  91. /* Traitement des erreurs, interruption du programme */
  92. syntax:
  93. erreur=RC
  94. if fr=1 then 'MESSAGE("Script SelectParts.AmiCAD"+CHR(10)+"Erreur de syntaxe"+CHR(10)+"en ligne 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
  95. else 'MESSAGE("SelectParts.AmiCAD script"+CHR(10)+"Syntax error"+CHR(10)+"in line 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
  96. exit
  97.  
  98. error:
  99. if fr=1 then 'MESSAGE("Script SelectParts.AmiCAD"+CHR(10)+"Erreur en ligne 'SIGL'")'
  100. else 'MESSAGE("SelectParts.AmiCAD script"+CHR(10)+"Error in line 'SIGL'")'
  101. exit
  102.